﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using System.ServiceModel;
using MaxLeaf.Platform.DataContract;

namespace MaxLeaf.Platform.Contract
{
    [ServiceContract]
    [ServiceKnownType("GetKnownTypes", typeof(KnownTypesProvider))]
    public interface IMtn
    {
        [OperationContract]
        object Select(object model, int intKeyValue);

        [OperationContract]
        List<object> SelectDtl(object model, int intForeignKeyValue);

        [OperationContract]
        SelectResult SelectByCond(object model, List<AddInfo> lstAddInfo);


        [OperationContract]
        SumResult Sum(object model, List<AddInfo> lstAddInfo);

        [OperationContract]
        object Add(object model);

        [OperationContract]
        object Update(object model);

        [OperationContract]
        bool Delete(object model);
        
        [OperationContract]
        bool Undelete(object model);
    }

    static class KnownTypesProvider
    {

        static Type[] GetKnownTypes(ICustomAttributeProvider knownTypeAttributeTarget)
        {

            return Assembly.Load("MaxLeaf.Platform.DataContract").GetTypes();

        }

    }
}
